package cn.wolfcode.shop.service.impl;

import cn.wolfcode.shop.domain.ProductSku;
import cn.wolfcode.shop.mapper.ProductSkuMapper;
import cn.wolfcode.shop.service.IProductSkuService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class ProductSkuServiceImpl implements IProductSkuService {
    @Autowired
    private ProductSkuMapper productSkuMapper;
    /**
     * 判断商品是否已经创建了sku
     * @param productId
     * @return
     */
    @Override
    public List<ProductSku> listByProductId(Long productId) {
        return productSkuMapper.listByProductId(productId);
    }

    /**
     * 获取订单中的商品
     * @param productSkuId
     */
    @Override
    public ProductSku selectByProductSkuId(Long productSkuId) {
        ProductSku productSku = productSkuMapper.selectByPrimaryKey(productSkuId);
        return productSku;
    }
}
